package com.fenghuajueli.module_user.network.di

import com.fenghuajueli.libbasecoreui.constants.AppConfigInfo
import kotlinx.serialization.json.Json
import okhttp3.Call
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor

/**
 * @Author: sz_ijj
 * @Date: 2024-03-20 16:54
 **/
object RetrofitDiModule {

    fun providesNetworkJson(): Json = Json {
        ignoreUnknownKeys = true
        isLenient = true
//        coerceInputValues = true
//        explicitNulls = false
    }


    fun okHttpCallFactory(): Call.Factory = OkHttpClient.Builder()
        .addInterceptor(
            HttpLoggingInterceptor()
                .apply {
                    if (AppConfigInfo.APP_DEBUG) {
                        setLevel(HttpLoggingInterceptor.Level.BODY)
                    }
                },
        )
        .build()
}